my file learn about tech container (docker, podman, kubernetes)
ENV key=value
ENV key1=value1 key2=value2
FROM golang:1.18-alpine
ENV APP_PORT=8080
RUN mkdir app
COPY main.go app/
EXPOSE ${APP_PORT}
CMD go run app/main.go
package main
import (
"fmt"
"net/http"
"os"
)
func main() {
port := os.Getenv("APP_PORT")
fmt.Println("Run app in port : " + port)
http.HandleFunc("/", HelloServer)
http.ListenAndServe(":" + port, nil)
}
func HelloServer(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello, World!")
}